import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
    base: './',
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: '@import "./src/assets/sass/base.scss";'
            }
        }
    },
    build: {
        sourcemap: false, // 不生成 source map 
        terserOptions: { 
          compress: { // 打包时清除 console 和 debug 相关代码
            drop_console: true,
            drop_debugger: true,
          },
        },
      },
    plugins: [
        vue(),
        Components({
            resolvers: [VantResolver()]
        })
    ],
    resolve: {
        alias: {
            '@': resolve('./src')
        }
    }
})
